layui.use('laydate', function(){
  var laydate = layui.laydate;
//日期时间选择器
  laydate.render({
    elem: '#J_DepartDate'
    ,type: 'datetime'
  });
});


$(function(){
	/*查询预定价格*/
	$("#childNum").blur(function(){
		
		var date=$("#J_DepartDate").val();
		var routeId=$("#J_LineBox").val();
		var mamNum=$("#mamNum").val();
		var childNum=$("#childNum").val();
		
		if(date==null||date==""){
			$("#msg").html("请填写日期！");
		}else if(date==null||date==""){
			$("#routeId").html("请选择旅游路线！");
		}else if(mamNum==null||mamNum==""){
			$("#mamNum").html("请填写成人数量！");
		}else if(mamNum<=0){
			$("#mamNum").html("成人数量不正确！");
		}else{
		$.ajax({
			url:"/travel/comm/total.do",
			data:{"date":date,"routeId":routeId,"mamNum":mamNum,"childNum":childNum},
			type:"post",
			dataType:"json",
			success:function(result){
				$("#price").html(result.price);
				$("#msg").html(result.msg);
			}
		});
		}
	});
	
	/*点击预定*/
	$("#yd_btn").click(function(){
		var date=$("#J_DepartDate").val();
		var routeId=$("#J_LineBox").val();
		var mamNum=$("#mamNum").val();
		var childNum=$("#childNum").val();
		location.href="/travel/order/toorder.html?date="+date+"&routeId="+routeId+"&mamNum="+mamNum+"&childNum="+childNum;
		
	})
	
	
	
})